package fichier;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SelectData{ 
	
	private DataBaseManager db = DataBaseManager.getInstance( );
	private Connection con = db.getConnexion();
	private static Statement lienBd  = null ;
	
	public static String TABLE = "";
	public static String REQUETE = "";
	
	public SelectData(){
		try{ 
			SelectData.lienBd =  con.createStatement(); } 
		catch (SQLException e) { 
			System.out.println(e + " [!] ERROR : selection de la database est un echec [!]"); 
		}
	}
	
	public static ResultSet startSelect(){ 
		ResultSet resultat = null;
		try  { 
			resultat = SelectData.lienBd.executeQuery(SelectData.REQUETE);  }  
		catch (SQLException e){
			System.out.println(e + "\n[!] ERROR : le lancement de la requete a echoue [!]"); }
			
		return resultat;
	}
	
	public static void startUpdate(){ 
		try  { 
			SelectData.lienBd.executeUpdate(SelectData.REQUETE);
			main.testUpdate = true;
			}  
		catch (SQLException e){
			System.out.println(e + "\n[!] ERROR : le lancement de la requete a echoue [!]");
			main.testUpdate = false;
			}
			
	}

	

}